<template>
  <h1>(插槽,自定义事件,props)</h1>
  <h3>我是Demo组件,props_msg:{{msg}}</h3>
  <button @click="click">点我触发hello事件</button>
  <slot name="header"></slot>
  <slot msg="Hello Demo"></slot>
  <slot name="footer"></slot>
</template>

<script>
export default {
  name: "Demo",
  props: ['msg'],
  emits: ['hello'],
  setup (props, context) {
    function click () {
      console.log(context);
      context.emit('hello', 'Hello Word')
    }
    return {
      click
    }
  }
}
</script>